package kr.hkit.powerjava.chapter24.work2;

import java.util.Scanner;

public class ServiceStudent {
	// 1. 시작(StudentDao 객체 생성, load())
	// 2. 메뉴보이기(prnMenu);
	// 3. 종료(StudentDao.save())

	private StudentDao dao;
	private Scanner sc;

	public ServiceStudent() {
		dao = new StudentDao();
		sc = new Scanner(System.in);
	}

	public ServiceStudent(StudentDao dao) {
		this.dao = dao;
		init();
	}

	private void init() {
		dao.loadFile();
		prnMenu();

	}

	private void prnMenu() {
		System.out.println("1.입력\n2.삭제\n3.수정\n4.검색\n5.리스트보기\n6.종료");
		int res =sc.nextInt();
		switch(res){
		case 1:
			break;
		case 2:
			dao.prnItemList(null);
			System.out.println("삭제 할 번호를 입력하시오");
			int delNum = sc.nextInt();
			dao.deleteItem(delNum-1);
			break;
		case 3://리스트를 보여주고
			dao.prnItemList(null);
			std = inputStdinfo(true);
			dao.updateItem(std);
			break;
		case 4://검색
			std = inputStdinfo(false);
			
			break;
		case 5:
			break;
		case 6:
			break;
			
		default:
	}
	}

	private Object inputStdinfo(boolean b) {
		// TODO Auto-generated method stub
		return null;
	}

	private void prnSubMenu() {
		System.out.println("1. 이름순 정렬 2. 성적순 정렬 3. 번호순 정렬");
		int res = sc.nextInt();
		switch (res) {
			case 1:
				break;
			case 2:
				break;
			case 3:
				dao.prnItemList(null);
				break;
			default:
				dao.prnItemList(null);

		}
	}
}
